<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('查看党员组织关系变动')" />
</head>
<body class="gray-bg">
	
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>查看党员组织关系变动</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m" id="form-change-view" th:object="${partyRelationshipChange}">
							<input name="id" th:field="*{id}" type="hidden">
							<div class="form-group">
								<label class="col-sm-3 control-label">关联党员：</label>
								<div class="col-sm-8">
									<p class="form-control-static" id="memberName"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">变动类型：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:if="*{changeType} == '1'">转入</p>
									<p class="form-control-static" th:if="*{changeType} == '2'">转出</p>
									<p class="form-control-static" th:if="*{changeType} == '3'">校内调动</p>
									<p class="form-control-static" th:if="*{changeType} == '4'">休学</p>
									<p class="form-control-static" th:if="*{changeType} == '5'">复学</p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">原组织：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{sourceOrg}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">目标组织：</label>
								<div class="col-sm-8">
									<p class="form-control-static" id="targetOrgName"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">变动日期：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{changeDate}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">变动原因：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{reason}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">经办人：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{handler}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">备注：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{remark}"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">创建时间：</label>
								<div class="col-sm-8">
									<p class="form-control-static" th:text="*{createTime}"></p>
								</div>
							</div>
							<div class="form-group">
								<div class="form-control-static col-sm-offset-9">
									<button type="button" class="btn btn-danger" onclick="closeItem()">关闭</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	
	<script type="text/javascript">
		var prefix = ctx + "system/partymember/change";
		
		$(function() {
			// 页面加载时显示党员和目标组织名称
			showMemberAndDeptInfo();
		});
		
		// 显示党员和目标组织名称
		function showMemberAndDeptInfo() {
			var memberId = $("#form-change-view input[name='memberId']").val();
			var targetOrgId = $("#form-change-view input[name='targetOrg']").val();
			
			// 获取党员信息
			if (memberId) {
				$.ajax({
					url: ctx + "system/partymember/member/list",
					type: "POST",
					data: {id: memberId},
					success: function(result) {
						if (result.rows && result.rows.length > 0) {
							$("#memberName").text(result.rows[0].name);
						} else {
							$("#memberName").text("未知党员");
						}
					},
					error: function() {
						$("#memberName").text("未知党员");
					}
				});
			}
			
			// 获取部门信息
			if (targetOrgId) {
				$.ajax({
					url: ctx + "system/dept/list",
					type: "POST",
					data: {deptId: targetOrgId},
					success: function(result) {
						if (result.rows && result.rows.length > 0) {
							$("#targetOrgName").text(result.rows[0].deptName);
						} else {
							$("#targetOrgName").text("未知组织");
						}
					},
					error: function() {
						$("#targetOrgName").text("未知组织");
					}
				});
			}
		}
		
		function closeItem() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
	</script>
</body>
</html>